﻿using System;
using System.Windows.Forms;
using Autofac;
using LocalOverride.Fiddler;
using LocalOverride.Fiddler.UI;

namespace LocalOverride.MappingEditorHarness
{
    public partial class MainForm : Form
    {
        private readonly IContainer container;

        public MainForm()
        {
            InitializeComponent();
            container = ComponentBuilder.SetupAutoFac(); 
        }

        private TabPage oPage;
        private Control oEditor;

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            oPage = new TabPage("Local Override");
            
            var presenter = container.Resolve<MappingEditorPresenter>();
            oEditor = (Control)presenter.View;

            oPage.Controls.Add(oEditor);

            oEditor.Dock = DockStyle.Fill;
            tabContainer.TabPages.Add(oPage);
        }
    }
}
